const path = require('path')
const resolve = dir => {
  return path.join(__dirname, dir)
}
const port = process.env.port || process.env.npm_config_port || 80 // 端口
module.exports = {
  publicPath: './',
  lintOnSave: false,
  chainWebpack: config => {
    config.resolve.alias
      .set('_c', resolve('src/components'))
      .set('@', resolve('src'))
    // key,value自行定义，比如.set('@@', resolve('src/components'))
  },
  devServer: {
    host: '0.0.0.0',
    port: port,
    open: false,
    proxy: {
      [process.env.VUE_APP_BASE_API]: {
        target: `http://gov.zhaimeibianli.com/gov`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_BASE_API]: ''
        }
      },
      [process.env.VUE_APP_SYSTIME]: {
        // target: `http://192.168.2.52:8183/houseUpload/system/com/getSysTime`,
        target: `https://boss.zhaimeibianli.com/houseUpload/system/com/getSysTime`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_SYSTIME]: ''
        }
      }

    },
    disableHostCheck: true
  },
  configureWebpack: {
    resolve: {
      alias: {
        '@': resolve('src')
      }
    },
  }
}